<?php
	
	$page=$this->page;
	$mdlContact=new Zendme_Models_Contact();
	$contact= $mdlContact->getItem();
	$map 	= str_replace("\\"," ",$contact['map']);

	$name		=	$this->formText('name',$this->Item['name'],array("class"=>"text"));
	$email		=	$this->formText('email',$this->Item['email'],array("class"=>"text"));
	$content	= 	$this->formTextarea('content',$this->Item['content'],array('rows'=>10));	
	$captcha 	= 	$this->captcha;
	$txtCaptcha = 	$this->formText('captcha','');
	$txtID 		= 	$this->formHidden('captchaID',$this->captcha_id);
		
	$urlCaptch		 = $this->baseUrl('default/index/captcha-image');
	
	$inputCaptcha	= $this->formText('captcha',null,array("class"=>"code"));
	$submit			= $this->formSubmit('submit','Gửi mail',array("class"=>"submit"));
	$linkContact	= $this->baseUrl('default/index/contact');
	
	if (count ( $this->messageError ) > 0) {
		$errors = $this->formErrors ( $this->messageError, array ('id' => 'errors' ) );
	}
	
?>

<!--------------------CONTENT (Start) ----------------------->
                <div class="content mar-top-20 width-100">
                	<div class="left">
                    	<div class="content-left">
                        	<div class="sub-left color-main">
                            	<a class="link-sub" href="#"><img src="<?php echo TEMPLATE_SYSTEM1_URL ?>/images/icon/icon-home-noactive.png" alt=""  /></a>
                                <p><?php echo $page['name'] ?></p>
                            </div>
                            
                            <!--------------------detail (Start) -------------------->
                            <div class="detail mar-top-10">
                            	<div class="contact" style="background: #FFF">
                            	
                            	 <?php  echo $this->flagSuccess ?>
                            	
							    <div class="contact-info">
							    <div class="contact-loc"><?php echo $page['content'] ?></div>					    	
							    </div>
							    <div class="contact-map"><?php //echo $contact['map'] ?></div>
							 
							    <?php 
							        if(empty($this->messages[0])):?>
							         <form action="<?php echo $linkContact;?>" method="post"  enctype="multipart/form-data" class="contact-form">
							             <div class="lev">
							                 <span>Họ và tên: </span><?php echo $name;?>
							                 <div><?php if(!empty($this->messageError['name'])):echo '<p class="msg_error">'.$this->messageError['name'].'</p>';endif;?></div>
							             </div>
							             <div class="lev">
							                 <span>Email: </span><?php echo $email;?>
							                 <div><?php if(!empty($this->messageError['email'])):echo '<p class="msg_error">'.$this->messageError['email'].'</p>';endif;?></div>
							             </div>
							             <div class="lev">
							                 <span>Nội dung: </span><?php echo $content ;?>
							                 <div><?php if(!empty($this->messageError['content'])):echo '<p class="msg_error">'.$this->messageError['content'].'</p>';endif;?></div>
							             </div>
							             
							             <!--  
							             <div class="lev">
							                  <span>Mã xác nhận: </span>
							                  <div>
							                  	<?php echo $inputCaptcha;?>                            	
							                  	<?php if(!empty($this->messageError['captcha'])):echo '<p class="msg_error">'.$this->messageError['captcha'].'</p>';endif;?>
							                  </div>	
							             </div>
							         	             
							             
							             <div class="lev">
							             	<div>
												<div class="border-img"><?php echo $txtID . $captcha;?></div>
								             	<span id="refresh" class="refresh"></span>
							             	  </div>
							             </div>
							            -->
							             
							             <div class="lev">
							             	<div><?php echo $submit;?></div>
							             </div>
							          </form>
							      <?php else:
							           echo '<div class="notice">'.$this->messages[0].'</div>';
							      endif;?>
					      </div>
                            </div>
						    
                            </div>                        
                            <!--------------------detail (End) ---------------------->
                           
                    </div>
                    
                     <div class="right">
                    	<div class="content-right">
                        	<div class="box-right">
                            	<div class="sub-right"><p>THÔNG BÁO TỪ CÔNG TY</p></div>
                                <div class="cnt-box-right">
                                	<div style="width:250px;margin-left:10px;padding-bottom:5px">
                                	<?php echo $this->page['summary'] ?>
                                	</div>
                                </div>
                            </div>
                        </div>
                    </div>      
                                      
                </div>
                <!--------------------CONTENT (End) ------------------------->

<script>
	function getData(data){
		$('.border-img').html(data);
		return false;
	}
	
	function refreshCaptcha(){
		var captchaID = $("#captchaID").val();
		$.get('<?php echo $urlCaptch . '/captchaID/';?>'+captchaID,getData);
	}
	$(document).ready(function(){
		$('#refresh').click(function(e){
			e.preventDefault();
			refreshCaptcha();
		});
	});
</script>